#include <REGX52.H>
#include "Delay.h"
#include "MatrixLED.h"

//code 将数据放在Flash中，放在RAM中太浪费，且RAM内存空间更小 
//但这个数据不能再其他地方更改
unsigned char code Animation[] = {
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
	0xFF,0x08,0x08,0x08,0xFF,0x00,0x0E,0x15,
	0x15,0x15,0x08,0x00,0x7E,0x01,0x02,0x00,
	0x7E,0x01,0x02,0x00,0x0E,0x11,0x11,0x0E,
	0x00,0xFD,0x00,0x00,0x00,0x00,0x00,0x00,
	0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00
};

void main()
{
	//keil支持C89，变量必须放在函数前面
	//eg: for(int i = 0;...;...)就是错误写法
	
	unsigned char Count = 0;
	unsigned char j = 0;
	unsigned char i = 0;
	unsigned char Offset = 0;
	MatrixLED_Init();
	while(1)
	{
		for (i = 0;i < 8;i++)
		{
			MatrixLED_ShowColRow(i,Animation[i + Offset]);//移向下一帧
		}
		if (Count > 10)//这里不能用Delay，不然会出现闪屏
		{
			Count = 0;
			Offset++;
		}
		Count++;
		if (Offset >= 40)//48-8,因为存在 i 最大为7(注意这是下标)
		{
			Offset = 0;//回到第一帧
		}
	}
}



















